<include file="Public:header" />
<form action="" method="" class="definewidth m20" id="equ-form">
<table class="table table-bordered table-hover definewidth m10">
    <tr>
        <td width="10%" class="tableleft">设备编号</td>
        <td><input type="text" name="number"/></td>
    </tr>

    <tr>
        <td class="tableleft">设备名称</td>
        <td><input type="text" name="name"/></td>
    </tr>
    <tr>
        <td class="tableleft">生产厂家</td>
        <td><input type="text" name="source"/></td>
    </tr>
    <tr>
        <td class="tableleft">设备信息</td>
        <td>
           <textarea style="width:auto;height: auto;" cols="40" rows="10" placeholder="参数、型号等信息" name="info"></textarea>
        </td>
    </tr>
    <tr>
        <td class="tableleft"></td>
        <td>
            <button class="btn btn-primary" type="button" id="add-equ">保存</button> &nbsp;&nbsp;<button type="button" class="btn btn-success" name="backid" id="backid">返回列表</button>
        </td>
    </tr>
</table>
</form>

<script>
    $(function () {
        $('#backid').click(function(){
            window.location.href="{:U('Home/Equipment/index')}";
        });

        $("#add-equ").click(function () {
            data = $("#equ-form").serialize();
            $.post(
                    "{:U('Home/Equipment/save')}",
                    data,
                    function(xhr){
                        if(200 == xhr.status){
                            alert(xhr.msg);
                            location.href = "{:U('Home/Equipment/index')}"
                        }else {
                            alert(xhr.msg);
                        }
                    }
            );
        });

    });
</script>

<include file="Public:footer" />